跳转到主要内容

综述

  • 谷歌当下最强最新 AI 视频模型
  • 生成速度比 Sora 2 快 50%
  • 时长只有 8s ,略逊一筹,但提供了首尾帧玩法,可以持续创建连贯性视频。
  • 本站仍然是价格屠夫,视频模型对比官网立省 80% 起。

模型卡

  • -fl 代表 帧转视频模式(Frame-to-Video)
  • -fast 代表快速生成视频模型,用时短、价格更便宜。
模型名描述价格
veo-3.1默认竖屏 视频$0.25
veo-3.1-fl竖屏+首尾帧转视频$0.25
veo-3.1-fast竖屏+快速$0.15
veo-3.1-fast-fl竖屏+快速+首尾帧转视频$0.15
veo-3.1-landscape横屏+首尾帧转视频$0.25
veo-3.1-landscape-fl横屏 视频$0.25
veo-3.1-landscape-fast横屏+快速$0.15
veo-3.1-landscape-fast-fl横屏+快速+首尾帧转视频$0.15

一、同步调用:对话补全接口

使用对话格式生成视频内容。 端点: POST /v1/chat/completions 请求头:
Content-Type: application/json
Authorization: sk-API令牌
请求参数:

示例 1: 文生视频

curl --location --request POST 'https://api.apiyi.com/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: $APIYI_key$' \
--data-raw '{
    "messages": [{"role": "user", "content": "画只猪在天上飞"}],
    "model": "veo_3_1",
    "stream": true,
    "n": 2
}'

示例 2: 帧转视频(Frame-to-Video)

curl --location --request POST 'https://api.apiyi.com/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: $APIYI_key$' \
--data-raw '{
    "messages": [{
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "根据两张图片生成一个完整的过渡视频"
            },
            {
                "type": "image_url",
                "image_url": {
                    "url": "开始帧图片URL或base64"
                }
            },
            {
                "type": "image_url",
                "image_url": {
                    "url": "结束帧图片URL或base64(可选)"
                }
            }
        ]
    }],
    "model": "veo-3.1-landscape-fast-fl",
    "stream": true,
    "n": 1
}'
说明:
  • 开始帧图片:必传,仅限一张。
  • 结束帧图片:可选,如果不传则自动生成过渡效果。

二、异步调用方式

1. 创建视频任务

创建异步视频生成任务。 端点: POST /v1/videos 请求头:
Content-Type: application/json
Authorization: sk-APIKEY
请求参数: 示例:
curl --location --request POST 'https://api.apiyi.com/v1/videos' \
--header 'Authorization: $APIYI_key$' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "画小猫",
    "model": "veo-3.1"
}'

2. 查询视频任务状态

查询视频生成任务的当前状态。 端点: GET /v1/videos/{video_id} 路径参数: 请求头:
Authorization: sk-APIKEY
示例:
curl --location --request GET 'https://api.apiyi.com/v1/videos/{video_id}' \
--header 'Authorization: $APIYI_key$'

3. 获取视频内容

获取已生成视频的实际内容。 端点: GET /v1/videos/{video_id}/content 路径参数: 请求头:
Authorization: sk-key
示例:
curl --location --request GET 'https://api.apiyi.com/v1/videos/{video_id}/content' \
--header 'Authorization: $APIYI_key$'

三、常见问题

问:需要传入 size 参数来调整分辨率吗?
答:不需要,通过模型来区分横屏还是竖屏, 默认为竖屏,带 landscape 的横屏。 生成视频的尺寸,格式为 widthxheight 竖屏:720x1280 横屏:1280x720
问:时长可以控制吗?
答:没法,单次调用输出为 8s 。 问:声音如何控制? 答:自带音轨。
问:在 apiyi 后台查看异步任务,发现这个任务是 OpenAI 类型,有问题吗?
答:没有问题,的确 VEO3.1 在我们系统的处理机制和 Sora 2 是一样的,于是这里显示类型为 OpenAI。模型本身能力还是谷歌提供的。 而在异步调用的输出信息里,task_type”:“sora2_video_generation”,也只是一个显示类型。

附:流式调用的输出结果示例

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"```json\n{\n    \"prompt\": \"画只猪在天上飞\",\n    \"mode\": \"竖屏模式\"\n}\n```\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e ⌛️ 视频正在生成中,请耐心等待...\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:9.0%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:18.0%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:27.0%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:36.0%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:45.9%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:54.9%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:63.9%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:72.9%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:83.7%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e 🏃 进度:90.2%\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e ✅ 第1个视频生成成功,[点击这里](https://veo-video.gptkey.asia/assets/flow/0af272c6-bcc7-48de-8a32-a827bad4392c.mp4) 查看视频~~~\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{"content":"\u003e ✅ 第2个视频生成成功,[点击这里](https://veo-video.gptkey.asia/assets/flow/9fc24060-ff7a-439e-a4f3-8387d25f63c9.mp4) 查看视频~~~\n\n"},"finish_reason":null}]}

data: {"id":"foaicmpl-2853cd7a-3005-464e-8f24-748053cbdb68","object":"chat.completion.chunk","created":1762181811,"model":"veo-3.1-fast","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":16,"completion_tokens":292,"total_tokens":308}}

data: [DONE]